package edu.cqie.smartfarm.verify.validation;

import edu.cqie.smartfarm.verify.anno.Phone;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class PhoneValidation implements ConstraintValidator<Phone,String> {
    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        if (s != null && s.matches("^1[3-9]\\d{9}$")){
            return true;
        }
        return false;
    }
}
